package springinaction;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import springinaction.events.CustomEventDispatcher;
import springinaction.springidol.PerformanceException;
import springinaction.springidol.Performer;



public class Main {

	public static void main(String[] args) throws PerformanceException {
		ApplicationContext context = new ClassPathXmlApplicationContext("springinaction/spring.xml");
		
		Performer performer = (Performer) context.getBean("hank2"); /* "kenny" */ /* "duke" */ /* "poeticDuke" */
		performer.perform();
		
		/*Custom spring event demonstration*/
		//context.publishEvent(new CourseFullEvent(this, new Course())); // 
		CustomEventDispatcher publisher = (CustomEventDispatcher) context.getBean("customEventDispatcher");
		publisher.dispatch();
	}

}
